package online.shenjian.nacos.consumer.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shenjian
 * @since 2022/12/10
 */
@RestController
@RequestMapping("/config")
@RefreshScope
@ConditionalOnProperty(name = "spring.cloud.nacos.config.enable", matchIfMissing = true)
public class NacosConfig {

    @Value("${cache.useLocalCache:false}")
    private boolean useLocalCache;

    @GetMapping("/get")
    public boolean getConfig() {
        return useLocalCache;
    }
}
